<?php

namespace Models;

class Logovani extends Base
{
	/**
	 * If user doesn't exist, create it. Otherwise update it.
	 * @return false on update, true on new user
	 */

        public function addLog($kdo,$kde,$co,$coid= null)
        {   $datum = new \DateTime();
           //Nette\Diagnostics\Debugger::dump($datum);
            return $this->db->query("
                    INSERT INTO logger (kdo, kde, co, coid, kdy) VALUES (%i, %s, %s, %i, %t)", $kdo, $kde, $co,$coid, $datum
                                    );

        }
        public function getLog()
        {
            return $this->db->dataSource("
                SELECT log.id as id,
                       cle.nick as nick,
                       log.kde as kde,
                       log.co as co,
                       CONCAT(' ',log.kdy,' ') as kdy
                FROM logger log
                LEFT JOIN pov_clenove cle ON(log.kdo=cle.id)
                ORDER BY log.kdy DESC
                                    ");

        }
//$this->db->query("UPDATE loan SET [to]=%t , problems=%sN WHERE idloan = %i", new \DateTime(), $problems, $loanId);
}